//Rationalcompare.cpp is a .cpp written by Daniel Hirst 3/26/2014	

#include "stdafx.h"
#include "Rationalcompare.h"
using namespace std;	
				
	
			 //this is a comparison function essentially you compare the Kurtosis and compare it to Extreme and Minor. I have picked arbitrary
			 //boundaries for those 2 values. Extreme is if deviations in the bearing are to do large extreme deviations and Minor is for
			 //frequent modest deviations. Exceding either value return an appropiate string message
          
           string Reason(double kurtosis, double tolerant)
                         {
                         
                                 double Extreme = tolerant;
                                 double Minor = tolerant * -1;
                               
                                 string extremeMess = "Bearing is not acceptably round do to Extreme deviations";
                                 string minorMess = "Bearing is not acceptably round do to frequent minor deviations";
                                 string noMess = "This bearing is acceptably round";
                                 string divideby = "The value entered does not exist and nothing can be infered";
                                 //string answer = "";
       
                               if (kurtosis == DIVIDE_BY_ZERO)
                               {
                                return divideby;
                               }
                               else{


                                 if (kurtosis > Extreme){
                                               
                                                return(extremeMess);}
                                         //richTextBox1->AppendText(" " + "Bearing is not acceptably round do to Extreme deviations" + " ");
                                 else if (kurtosis < Minor){
                                               
                                                return(minorMess);}
                                 //richTextBox1->AppendText(" " + "Bearing is not acceptably round do to frequent minor deviations"+ " ");
                                 else
                                               
                                                return(noMess);
                                 
                                         //richTextBox1->AppendText(" " + "This bearing is acceptably round"+ " ");

                                 }
                                 }

			 string Reason(double kurtosis)
			 {
				 double Extreme = 0.5;
				 double Minor = -0.5;
				
				 string extremeMess = "Bearing is not acceptably round do to Extreme deviations.";
				 string minorMess = "Bearing is not acceptably round do to frequent minor deviations.";
				 string noMess = "This bearing is acceptably round.";
				 //string answer = "";
	 if (kurtosis == DIVIDE_BY_ZERO)
                               {
                                return divideby;
                               }
                               else{
				

				 if (kurtosis > Extreme){
						
						return(extremeMess);}
					 //richTextBox1->AppendText(" " + "Bearing is not acceptably round do to Extreme deviations" + " ");
				 else if (kurtosis < Minor){
						
						return(minorMess);}
				 //richTextBox1->AppendText(" " + "Bearing is not acceptably round do to frequent minor deviations"+ " ");
				 else
						
						return(noMess);
				 
					 //richTextBox1->AppendText(" " + "This bearing is acceptably round"+ " ");

			 }
          }
          
           string SkewK(double skew, double tolerant){
                                 
                                 double skewcheck = tolerant;

                                 string largeradius = "Bearing's radii is skewed to the right and the radii are tending towards larger values";
                                 string smallradius = "Bearing's radii is skewed to the left and the radii are tending towards smaller values";
                                 string noskew = "Bearing radii are symmetrical or balanced asymmetrical";
                                   if (skew == DIVIDE_BY_ZERO)
                               {
                                return divideby;
                               }
                               else{
                                  
                                  if (skew > skewcheck)
                                         return(largeradius);
                                 else if (skew < skewcheck)
                                         return(smallradius);
                                 else
                                 {
                                        return(noskew);
                                 }
                         }}


			 string SkewK(double skew){
				 
				 double skewcheck = 0;

				 string largeradius = "Bearing's radii is skewed to the right and the radii are tending towards larger values.";
				 string smallradius = "Bearing's radii is skewed to the left and the radii are tending towards smaller values.";
				 string noskew = "Bearing radii are symmetrical or balanced asymmetrical.";
         if (skew == DIVIDE_BY_ZERO)
                               {
                                return divideby;
                               }
                               else{
        
				  if (skew > skewcheck)
					 return(largeradius);
				 else if (skew < skewcheck)
					 return(smallradius);
				 else
				 {
					return(noskew);
				 }
             }
			 }